﻿using System;
using System.Collections.Generic;
using System.Text;
using T.FAS.Runtime.Base.Common;
using T.FAS.Runtime.Excel.Entity;

namespace T.FAS.Runtime.Excel.Dao
{
    public class ExportTaskLogic
    {
        readonly ExportTaskDao dao = new ExportTaskDao();
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="exportTask"></param>
        public void CreateTask(ExportTask exportTask)
        {
            dao.Add(new List<object> { exportTask });
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="exportTask"></param>
        public void UpdateTask(ExportTask exportTask)
        {
            dao.Update(new List<object> { exportTask });
        }
        /// <summary>
        /// 获取导出任务列表
        /// </summary>
        /// <param name="cdoID"></param>
        /// <returns></returns>
        public List<ExportTask> GetTaskList(string metaDataID)
        {
            return dao.GetTaskList(metaDataID);
        }
        /// <summary>
        /// 查询导出任务列表
        /// </summary>
        /// <param name="ID"></param>
        public Dictionary<string, object> GetTaskList(string dataQueryID, Dictionary<string, string> filter)
        {
            return dao.GetTaskList(dataQueryID, filter);
        }
        /// <summary>
        /// 获取过期任务列表
        /// </summary>
        /// <param name="date"></param>
        /// <returns></returns>
        public List<ExportTask> GetOutofdateTaskList(DateTime date)
        {
            return dao.GetOutofdateTaskList(date);
        }
        /// <summary>
        /// 获取任务
        /// </summary>
        /// <param name="taskID"></param>
        public ExportTask GetTask(string taskID)
        {
            return dao.GetObject(taskID);
        }
        /// <summary>
        /// 删除任务
        /// </summary>
        /// <param name="taskID"></param>
        public void DeleteTask(string taskID)
        {
            dao.Delete(new List<string> { taskID });
        }
        /// <summary>
        /// 清空任务
        /// </summary>
        public void ClearTask(string dataQueryID)
        {
            string userID = UserUtil.GetCurrentUserID();
            dao.ClearTask(userID, dataQueryID);
        }
    }
}
